package com.eamois.ui.util;

import java.awt.Component;

import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;

public class MenuTreeRenderer extends DefaultTreeCellRenderer {
	public MenuTreeRenderer() {

	}

	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
		super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
				row, hasFocus);
		DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
		if (node.isRoot()) {
			setIcon(new ImageIcon(com.eamois.icon.GetIcons.class
					.getResource("module.gif")));
		}else {
			setIcon(new ImageIcon(com.eamois.icon.GetIcons.class
					.getResource("menu.gif")));
		}
		return this;
	}
}
